package com.cxh.mchat.user.controller;


import com.baomidou.mybatisplus.extension.api.R;
import com.cxh.mchat.bussiness.bean.UserContactsReqBean;
import com.cxh.mchat.user.entity.UserContacts;
import com.cxh.mchat.user.service.IUserContactsService;
import com.cxh.mchat.user.service.IUserService;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;

/**
 * <p>
 * 用户联系人 前端控制器
 * </p>
 *
 * @author cxh
 * @since 2021-12-30
 */
@RestController
@RequestMapping("/api/contacts/")
public class UserContactsController {

    @Resource
    private IUserContactsService userContactsService;
    @Resource
    private IUserService userService;

    @PostMapping("/add")
    public R<Boolean> add(@RequestBody @Validated UserContacts reqBean){
        return R.ok(userContactsService.add(reqBean));
    }

    @GetMapping("/query")
    public R<List<UserContacts>> queryList(UserContactsReqBean reqBean){
        return R.ok(userContactsService.query(reqBean));
    }
}
